package cn.teacher.dao;

import cn.teacher.pojo.CompetitionPlan;
import cn.teacher.pojo.dto.CompetitionInfoDTO;
import cn.teacher.pojo.dto.CompetitionPlanDTO;
import cn.teacher.pojo.dto.RegisterCompetitionDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 毛苏宇
 * User: me
 * Date: 2020/6/25
 * Time: 19:01
 * Description:
 */
@Mapper
@Repository
public interface CompetitionPlanDaoMapper {

    /**
     * 插入竞赛计划
     *
     * @param competitionPlan
     * @return
     */
    int insert(CompetitionPlan competitionPlan);


    /**
     * 删除竞赛计划
     *
     * @param cpId
     * @return
     */
    int delete(@Param("cpId") long cpId);


    /**
     * 更新竞赛计划
     *
     * @param competitionPlan
     * @return
     */
    int update(CompetitionPlan competitionPlan);


    /**
     * 查询全部，包括对应的老师信息
     * @return
     */
    List<CompetitionPlanDTO> selectCompetitionPlanByUserId(@Param("userId") long userId);


    /**
     * 查询某学生选择的所有竞赛
     * @param userId
     * @return
     */
    List<RegisterCompetitionDTO> selectRegisterCompetitionDTO(@Param("userId") long userId);


    /**
     * 查询所有竞赛信息
     * @return
     */
    List<CompetitionInfoDTO> selectCompetitionPlans();


    /**
     * 根据竞赛id查询竞赛信息
     * @return
     */
    CompetitionInfoDTO selectOne(@Param("cpId")long cpId);
}
